#ifndef _WINDSOUL_FILE_H_
#define _WINDSOUL_FILE_H_

// #include "ArkCommonDefs.h"

namespace ArkCommon
{
	namespace Package
	{		
		class CPkgFile
		{
		public:
			CPkgFile();
			CPkgFile(const char* name,bool binary=true);
			~CPkgFile();
			int Open(const char *name,bool binary=true);
			int Seek(int pos,int origin=SEEK_SET);
			int Tell() const { return _position; }
			int Read(void *buffer,size_t len);

			bool IsInPackage()const
			{
				return _offset>0;
			}
			bool IsValid()const
			{
				return _file_handle!=0;
			}
			int Size()const
			{
				return _length;
			}

			void Close();

			operator bool()const
			{
				return IsValid();
			}
		private:
			CPkgFile(const CPkgFile &);
			CPkgFile& operator= (const CPkgFile &);
						
			void* _file_handle;
			int _offset;
			int _position;
			int _length;
		};
	}
}



using namespace ArkCommon::Package;

#endif
